<?php
include_once("functions/db_manipulate.php");

$resultSet = getAllNews();

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title><?= getMessageByKey("articles.archive.title") ?></title>
    <link rel="stylesheet" href="css/navigation.css">
    <link rel="stylesheet" type="text/css" href="css/news.css">
    <link rel="stylesheet" type="text/css" href="css/square.css">
    <link rel="stylesheet" type="text/css" href="css/menu.css">
    <link rel="stylesheet" type="text/css" href="css/common.css">
    <script src="resources/jquery.js"></script>

    <meta charset="<?= getMessageByKey("default.charset") ?>">
</head>
<body class="body">

<?php
include_once("menu.php");
?>

<div id="square">
    <div class="archive">
        <?php
        $date = "";
        while ($row = mysql_fetch_assoc($resultSet)) {
            if ($date != $row['date']) {

                ?>
                <div class="archivedatediv">
                    <?= $row['date'] ?>
                </div>
                <?php
                $date = $row['date'];
            }

            ?>

            <div class="archive_new" onclick="location.href='?action=new&nid=<?php echo $row['id'] ?>'">
                <div class="archivenew_info">
                    <div class="new_infotd">
                        #<?= $row['id'] ?>
                    </div>
                    <div class="new_infotd" style="text-align: right">
                        <?= $row['date'] ?>
                    </div>
                    <div class="new_infotd" style="text-align: right">
                        <?= $row['time'] ?>
                    </div>
                </div>
                <div class="archivenew_header">
                    <?= $row['header'] ?>
                </div>
                <div class="archivenew_content">
                    <?= getTextPart($row['content'], 100) ?>
                </div>
            </div>

        <?php
        }
        ?>
    </div>
</div>

<?php
include_once("navigation.php");
?>

</body>
</html>
